package com.collection;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import com.util.Util;

public class MapExam {
    Map<String,String> pMap1 = 
    		new HashMap<String,String>();
    Map<String,Object> pMap2 = 
    		new HashMap<String,Object>();
    Map<String,String> pMap3 = 
    		new Hashtable<String,String>();
    Map<String,Object> pMap4 = 
    		new Hashtable<String,Object>();
    
	public Map<String,String> setHashMap(){
		pMap1.put("one","grape");
		pMap1.put("two","banana");
		pMap1.put("three","kiwi");
/*		pMap1.put("four",1);type none equal
		pMap1.put("five",false);*/
		pMap2.put("four",1);
		pMap2.put("five",true);
		Util u = new Util();
		pMap2.put("six", new Util());
		pMap2.put("seven", u);
		pMap2.put("eight", "hello");
		return pMap1;
	}
	public void getHashMap(Map<String,String> pMap){
		Object[] key = null;
		if(pMap.isEmpty()) return;
		for(int i=0;i<pMap.size();i++)
		{
			key = pMap.keySet().toArray();
			System.out.println("key : "+key[i]);
			System.out.println("value : "+pMap.get(key[i]));
		}
	}
	public MapExam(){
		pMap1 = setHashMap();
		getHashMap(pMap1);
	}
	public static void main(String[] args) {
		new MapExam();
	}
}
